package com.example.demo.threadpool;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @author whn
 */
@Configuration
public class PoolConfig {

    @Bean
    public ThreadPoolExecutor executor(){
        ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(4, 6, 5, TimeUnit.MILLISECONDS, new LinkedBlockingDeque<>(1000));
        return threadPoolExecutor;
    }
}
